package pri.damai.xiaowu.anydoor.business.group;

import io.netty.channel.ChannelHandlerContext;
import lombok.Data;
import pri.damai.xiaowu.anydoor.business.BaseModel;
import pri.damai.xiaowu.anydoor.netty.ChannelStore;

import java.util.Map;

/**
 * 查看群列表
 * @Desc
 * @Author yxf
 * @Date 2022/7/27 20:22
 * 但行好事，莫问前程。
 */
@Data
public class GroupListReq implements BaseModel {
    @Override
    public Byte code() {
        return 13;
    }

    @Override
    public void process(ChannelHandlerContext ctx) {
        Map<String, String> groupNameMap = ChannelStore.GROUP_NAME_MAP;

        GroupListRsp rsp = new GroupListRsp();
        rsp.setGroups(groupNameMap);
        ctx.channel().writeAndFlush(rsp);
    }
}
